<template>
  <div>
    <a-modal v-model:visible="visible">
      <template #title> 酒罐编辑 </template>
      <a-form :model="form" :rules="rules" ref="formRef" @submit="handleSubmit">
        <a-form-item label="酒罐名称" name="wine_tank_name">
            
          <a-input v-model="form.wine_tank_name" placeholder="请输入酒罐名称" allow-clear />
        </a-form-item>
        <a-form-item label="酒罐容量" name="wine_tank_capacity">
          <a-input
            v-model="form.wine_tank_capacity"
            placeholder="请输入酒罐容量"
          >
            <template #append> 公斤 </template>
          </a-input>
        </a-form-item>
        <!-- <a-form-item label="酒罐库存" name="wine_tank_stock">
          <a-input
            v-model:value="form.wine_tank_stock"
            placeholder="请输入酒罐库存"
          />
        </a-form-item> -->
        <a-form-item label="酒罐类别" name="wine_tank_status">
          <a-select
            v-model="form.wine_tank_status"
            placeholder="请选择酒罐类别"
          >
            <a-option value="1">大楂</a-option>
            <a-option value="2">二楂</a-option>
            <a-option value="3">混楂</a-option>
          </a-select>
        </a-form-item>
      </a-form>
      <template #footer>
        <a-button type="primary" @click="save">确定</a-button>
      </template>
    </a-modal>
  </div>
</template>

<script lang="ts" setup>
import { ref, reactive } from 'vue';
import { saveWineTank } from '@/api/winepro';
import { Message } from '@arco-design/web-vue';
const props = defineProps({
  getTankList: { type: Function },
});
const visible = ref(false);

const save = async () => {
  const { code, message } = await saveWineTank(form);
  if (code === 200) {
    props.getTankList();
    visible.value = false;
    Message.success(message);
  }
};
const openDialog = (type = true) => {
  visible.value = true;
};
const form = reactive({
  id: '',
  wine_tank_name: '',
  wine_tank_capacity: 0,
  // wine_tank_stock: '',
  wine_tank_status: '1',
});
defineExpose({
  openDialog,
});
</script>

<style lang="scss" scoped></style>
